package com.example.springioc.demo2.config;

import com.example.springioc.demo2.model.User;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2024-11-17
 * Time: 19:54
 */
@Component
public class BeanConfig {
    @Bean()
    public User user(){
        User user = new User();
        user.setName("zhangsan");
        user.setAge(18);
        return user;
    }
    @Bean()
    public User userDemo1(){
        User user = new User();
        user.setName("lisi");
        user.setAge(18);
        return user;
    }

    @Bean("test2")
    public User userDemo2(){
        User user = new User();
        user.setName("wangwu");
        user.setAge(18);
        return user;
    }

    @Bean("test3")
    public User userDemo3(){
        User user = new User();
        user.setName("xiaoliu");
        user.setAge(18);
        return user;
    }
}
